package com.by.service.impl;

import cn.hutool.core.map.MapUtil;
import com.by.bean.SupplierEnquiry;
import com.by.common.bean.PageBean;
import com.by.common.crud.BaseServiceImpl;
import com.by.mapper.SupplierEnquiryMapper;
import com.by.mapper.SupplierMapper;
import com.by.service.SupplierEnquiryService;
import com.by.service.SupplierService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author Ye QS
 * @version 0.1
 * @className SupplierEnquiryServiceImpl
 * @description
 * @date 2024/9/25 15:14
 * @since jdk11
 */
@Service
public class SupplierEnquiryServiceImpl extends BaseServiceImpl<SupplierEnquiry, SupplierEnquiryMapper> implements SupplierEnquiryService {
    @Override
    public PageBean queryCust(Map map) {
        int page = MapUtil.getInt(map, "page");
        int pageSize = MapUtil.getInt(map, "pageSize");
        //设置分页
        PageHelper.startPage(page, pageSize);// 后面紧跟查询
        List<Map> list = baseMapper.queryCust(map);

        //获取分页信息 将查询结果封装一下
        PageInfo info = new PageInfo(list);

        return new PageBean(page, pageSize, info.getTotal(), list);
    }
}
